import React, { Suspense, useEffect } from 'react'
import { Provider } from 'react-redux'
import routes from './router'
import { BrowserRouter } from 'react-router-dom'
import { renderRoutes } from 'react-router-config'
import store from './store'
import openMusic from '@/utils/openMusic'
import LwFireWords from 'lw_firewords'

function App() {
  useEffect(() => {
    openMusic()
    new LwFireWords().init()
  }, [])

  return (
    <Provider store={store}>
      <BrowserRouter>
        <Suspense fallback={<div>正在加载中...</div>}>
          {renderRoutes(routes)}
        </Suspense>
      </BrowserRouter>
    </Provider>
  )
}

export default App
